from api import log
from config import HOST


class ApiTender:
    # 初始化
    def __init__(self, session):
        # 获取session
        self.session = session
        # 后台投资url
        self.__url_tender = HOST + "/trust/trust/tender"

    # 后台投资接口 封装
    def api_tender(self, amount):
        # 请求参数
        data = {
            "id": 642,
            "depositCertificate": -1,
            "amount": amount
        }
        log.info("正在调用后台投资接口，请求方法post，请求url:{} 请求参数:{}".format(self.__url_tender, data))
        # 请求方法
        return self.session.post(url=self.__url_tender, data=data)
